
use std::path::PathBuf;

use gfsc::*;

pub fn main() {

    if std::env::args().len() < 4 {
        println!("{} down_file_name idx where_is_router.json", std::env::args().nth(0).unwrap_or_default());
        return
    }

    let filename = std::env::args().nth(1).expect("no file given");
    let fidx = std::env::args().nth(2).expect("no idx given");
    let conf = std::env::args().nth(3).expect("no router.json given");
    let idx = fidx.parse::<i32>().unwrap() ;
    let router = gfsc_new_router( conf.as_str() ).unwrap();
    
    let downpath = PathBuf::from("./download");
    let f = gfsc_copy_file(&router, router.cur_dynasty, idx, &filename.as_str(), &downpath , &filename.as_str() );
    let rt = tokio::runtime::Runtime::new().unwrap();
    let r = rt.block_on(f);
    println!("{:#?}", r);
}
 